//
//  TcpClientUtil.h
//  TestTcpUdp
//
//  Created by leeson zhong on 2021/7/7.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@protocol TcpClientUtilDelegate
@optional
-(void)onTcpClientConnectServer:(BOOL)flag;
-(void)onTcpClientReceiveData:(NSData *)data ServerIp:(NSString *)serverIp ServerPort:(int)serverPort;
-(void)onTcpClientClose;

@end

@interface TcpClientUtil : NSObject

@property (nonatomic,weak) id<TcpClientUtilDelegate> delegate;

-(BOOL)initWithServerIp:(NSString *)ip Port:(int)port;
-(BOOL)sendData:(NSData *)data;
-(void)close;

-(NSString *)getServerIp;
-(int)getServerPort;

@end

NS_ASSUME_NONNULL_END
